package leetcode_601_700;

public class LeeCode_693 {
    public static void main(String[] args) {

    }
    private static boolean hasAlternatingBits(int n) {
        int next = 0;
        if ((n & 1) == 0){
            next = 1;
        }
        n >>= 1;
        while (n != 0){
            if ((n & 1) == next){
                next = next == 0 ? 1 : 0;
            }else {
                return false;
            }
            n >>= 1;
        }
        return true;
    }
}
